package controllers

import (
	//"encoding/json"
	//"errors"
	//"github.com/astaxie/beego"
	// "lottery/constant"
	"lottery/models"
	// "lottery/utils"
	"strconv"
)

type GameCtl struct {
	BaseCtl
}

func (g *GameCtl) GetGames() { //获取赛事列表  对应网站的
	if !g.isLogin() {
		g.SetJson("请先登录！", nil)
		return
	}
	Id := g.Input().Get("platformId")
	//beego.Error("platformId", Id)
	platformId, err := strconv.Atoi(Id)
	if err != nil {
		g.SetJson(nil, err)
		return
	}
	userId := g.GetUserId()
	games, err := models.GetGameList(userId, platformId)
	if err != nil {
		g.SetJson(nil, err)
		return
	}
	g.SetJson(games, nil)
	return
}
